New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/graphql

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/graphql

GitHub GraphQL API client for browsers and Node

6.0.1
Source
npm
Version published
Maintainers
4
Created

What is @octokit/graphql?

The @octokit/graphql npm package is designed to simplify making GraphQL queries to the GitHub API. It provides a straightforward way to execute queries and mutations, handle authentication, and manage GraphQL variables. This package is part of the Octokit suite, which is officially maintained by GitHub, ensuring high compatibility and reliability for developers interacting with GitHub's data.

What are @octokit/graphql's main functionalities?

Executing a GraphQL query

This feature allows you to execute a basic GraphQL query to fetch the login name of the authenticated GitHub user. You need to replace 'YOUR_GITHUB_TOKEN' with your actual GitHub token.

{
  "query": "query { viewer { login }}",
  "headers": {
    "authorization": "token YOUR_GITHUB_TOKEN"
  }
}

Executing a GraphQL mutation

This feature demonstrates how to execute a mutation to create a new issue in a repository. You need to replace 'REPOSITORY_ID' and 'YOUR_GITHUB_TOKEN' with your repository's ID and your GitHub token, respectively.

{
  "mutation": "mutation ($repositoryId: ID!, $issueTitle: String!) { createIssue(input: {repositoryId: $repositoryId, title: $issueTitle}) { issue { id } } }",
  "variables": {
    "repositoryId": "REPOSITORY_ID",
    "issueTitle": "New Issue Title"
  },
  "headers": {
    "authorization": "token YOUR_GITHUB_TOKEN"
  }
}

Other packages similar to @octokit/graphql

Keywords

octokit

FAQs

Package last updated on 20 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts